//项目名


import {baseAPI} from "@/core/config/ApiConfig";
import {SiteApi} from "@/core/request/api/SiteApi";
// eslint-disable-next-line no-unused-vars
var siteName=null
let globalValue={
    protectTitle() {
        if (siteName!=null) return siteName
    var xhr=new XMLHttpRequest()
    xhr.open('GET',baseAPI+SiteApi.getAttributeByCommon+'siteName',false)
        // xhr.setRequestHeader(
        //     'ngrok-skip-browser-warning','1'
        // )
    xhr.send(null)
    if (xhr.status==200) return siteName=JSON.parse(xhr.responseText).data
    else
        return siteName="XXXX管理系统"
   },
    BASE64HEADER:"data:image/png;base64,",
    downloadFn: (flow = null) => {
        if (!flow) return
        const blob = new Blob([flow])
        const blobUrl = window.URL.createObjectURL(blob)

        const a = document.createElement('a')
        a.style.display = 'none'
        a.download = new Date().getTime()+'.csv' // 自定义下载的文件名
        a.href = blobUrl
        a.click()
    }
}

export {
    globalValue
}